#include "joy_control.h"

Joy_control::Joy_control()
{
    joy_subscriber = n.subscribe<sensor_msgs::Joy>("joy",10,&Joy_control::callback_joy,this);
    joy_control_pub = n.advertise<geometry_msgs::Twist>("turtle1/cmd_vel",10);

}


void Joy_control::callback_joy(const sensor_msgs::Joy::ConstPtr& joy_receive)
{
    joy_transform.angular.z = 2  * joy_receive->axes[0];
    joy_transform.linear.x = 2 * joy_receive->axes[1];
    ROS_INFO("angular:[%f];linear:[%f]",joy_transform.angular.z,joy_transform.linear.x);
    joy_control_pub.publish(joy_transform);
}
